<?php
/**
 * User: lishu
 * Date: 12/7/2017 AD
 * Time: 11:36
 */
namespace App\Models\Mysql;

//use Illuminate\Database\Eloquent\Model;
use App\Models\Traits\BaseDBMethod;

class outstanding_translation
{
	use BaseDBMethod;
	//数据库连接配置项，见config/database.php
	const DATABASE_CONF = 'lqyw_mysql';

	//数据库连接配置项，见config/database.php
	//如果需要用ORM，需要设置此项
//	protected $connection = self::DATABASE_CONF;
	//表名，如果需要用ORM，需要设置此项
//	protected $table = self::TABLE_NAME;

	public static function get_best($start, $count)
	{
		return self::getConnObj()->select(
			"select ct_task.commentendtime, ft.tid, ft.authorid, ft.author authorName, ft.subject, ft.replies replyCount, fp.pid pid, fp.message body, weightedvotes voteCredits, 0 polished from pre_ct_task ct_task, pre_forum_thread ft, pre_forum_post fp, pre_ct_translatedtext ct_tran, pre_forum_polloption fpo where ct_task.besttid=ft.tid and ft.tid=fp.tid and fp.first=1 and ct_task.besttid=ct_tran.tid and ct_tran.polloptionid=fpo.polloptionid and ct_task.status=3 and ct_task.besttid>0 order by commentendtime desc limit $start, $count"
		);	
	}


    public static function get_polishedbest($start, $count)
    {
		return self::getConnObj()->select(
			"select ct_task.commentendtime, ft.tid, ft.authorid, ft.author authorName, ft.subject, ft.replies replyCount, fp.pid pid, fp.message body, 1 polished from pre_ct_task ct_task, pre_forum_thread ft, pre_forum_post fp where ct_task.polishedbesttid=ft.tid and ft.tid=fp.tid and fp.first=1 and ct_task.status=3 and ct_task.polishedbesttid>0 order by commentendtime desc limit  $start, $count;"
		);	
    }

}